<%@ include file="header.jsp"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<h2>Geschiedenis - TODO: from DB</h2>
<c:if test="${not empty items}">
<table>
	<tr>
		<th>Product</th>
		<th>Prijs</th>
		<th>Aantal</th>
		<th>Totaal</th>
	</tr>
	<c:set var="total" value="0" />
	<c:forEach var="item" items="${items}">
		<c:set var="total" value="${total + item.value*item.key.price}" />
		<tr>
			<td><a
				href="<%=request.getContextPath()%>/product/${item.key.id}">${item.key.name}</a></td>
			<td>&euro; ${item.key.price}</td>
			<td>${item.value}x</td>
			<td>&euro; <fmt:formatNumber
					value="${item.value*item.key.price}" type="number" /></td>
		</tr>
	</c:forEach>
	<tr>
		<td colspan="4">&nbsp;
	</tr>
	<tr>
		<th colspan="2">Totaal prijs:</th>
		<th colspan="2">&euro; <fmt:formatNumber value="${total}"
				type="number" /></th>
	</tr>
</table>
</c:if>
<%@ include file="footer.jsp"%>

